<?php
require_once(APPLICATION_PATH."/modules/third/controllers/BaseController.php");

class DefaultController extends BaseController {
	
	protected $_layoutPath = 'default';
	
	public function init( ) {
		
		$module = $this->getRequest()->getModuleName();
		
		$this->view->base_url = '/' . $this->getRequest ()->getBaseUrl ();
		
		//CONTROLLER URL
		$this->controller_url = $this->_request->getBaseUrl () . '/third/' . $this->name;
		$this->view->controller_url = $this->controller_url;
		
		// jQuery
		$this->view->addHelperPath ( 'ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper' );
		
		//Configs
		$this->initConfigs ();
		
		//db
		$this->db = Zend_Registry::get ( 'db' );
		
		//cache
		$this->cache = Zend_Registry::get ( 'cache' );
		
		//auth
		$this->_auth = Zend_Registry::get ( 'auth' ); 
		
		//LOGGED USER
		$this->_logged = $this->_auth->getLogged();
		$this->view->assign('logged', $this->_logged );

		$template = $this->_site['template'];
		$this->_layoutPath = $template;
		
		//LAYOUT OPTIONS
		$this->_layout = Zend_Layout::getMvcInstance ();
		$this->setLayout ();
		$this->setLayoutPath ( $this->_layoutPath );
		$this->disableLayoutInAjax ();
		
		//FLASH MESSAGES
		$this->_flashMessenger 	= $this->_helper->getHelper('FlashMessenger');
		
		//REDIRECTOR
		$this->_redirector = $this->_helper->getHelper('Redirector');

		//LOAD SITE INFOS
		$this->_site = Zend_Registry::get('site');
		if( $this->_site )
			$this->view->assign('site', $this->_site );
		else
			$this->flash('Testes', 'error',"/error/site-not-found");
		
		
		$this->_frontController = Zend_Controller_Front::getInstance();
	}
	

}


?>